class Product {
  final String name;

  final double price;
  Product(this.name, this.price);
}

abstract class EventHandler {
  EventHandler? nextHandler;
  void setNext(EventHandler handler) {
    nextHandler = handler;
  }

  void handleEvent(Product product);
}

class LoggingHandler extends EventHandler {
  @override
  void handleEvent(Product product) {
    nextHandler?.handleEvent(product);
  }
}

class AuthorizationHandler extends EventHandler {
  @override
  void handleEvent(Product product) {
    nextHandler?.handleEvent(product);
  }
}
